// http://poj.org/problem?id=2309

#include <iostream>
using namespace std;

int main() {
    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        int k = n & -n;  // lowbit(n)
        cout << n - k + 1 << " " << n + k - 1 << endl;
    }
    return 0;
}